<?php
/**
 * 富文本上传文件控制器
 * @author ran.ran
 */
namespace api\controllers;

use Yii;
use yii\web\Controller;

class UeditorUploadController extends Controller
{

    public $enableCsrfValidation = false;
    public $layout = false;
    
    private  $is_login = false;
    
    public function init()
    {
        parent::init();
        
        header('Access-Control-Allow-Origin:*');
        header('Access-Control-Allow-Headers: X-Requested-With,X_Requested_With');
        
    }
    
    public function actions() {
        return [
            'upload' => [
                'class' => 'kucha\ueditor\UEditorAction',
                'config' => [
                    'imageUrlPrefix' => \Yii::getAlias('@static'), //图片访问路径前缀
                    'imagePathFormat' => \Yii::$app->params['upfile'].'{yyyy}{mm}{dd}/{time}{rand:6}', //上传保存路径
                ],
            ],
        ];
    }

}

?>